package com.realtyreg.webview.tiles;

import org.apache.tiles.AttributeContext;
import org.apache.tiles.preparer.ViewPreparer;
import org.apache.tiles.request.Request;
import org.springframework.stereotype.Component;
import com.realtyreg.domain.entity.users.Profile;

/**
 * Created by Petro 23.12.12 22:04
 */
@Component("titlePreparer")
public class TitlePreparer implements ViewPreparer {

    public void execute(Request tilesContext, AttributeContext attributeContext) {
        Profile profile = (Profile) tilesContext.getContext("request").get("profile");
        tilesContext.getApplicationContext().getApplicationScope().put("name", profile.getUser().getSurName());
    }
}
